<!DOCTYPE html>
<html>
<head>
    <meta charset="UTF-8">
    <!-- import CSS -->
    <link rel="stylesheet" href="https://cdn.staticfile.org/element-ui/2.15.9/theme-chalk/index.css">
    <style>
        .el-menu.el-menu--horizontal {
            border-bottom: 0;
        }
        body {
            font-size: 14px;
            font-family: 微软雅黑, "Microsoft Yahei", arial, 宋体, simsun;
            margin: 0;
            padding: 0;
            border: 0;
        }
        .top_a {
            width: 100%;
            height: 35px;
            position: relative;
            background-color: #f6f6f6;
        }
        .top_b {
            width: 100%;
            height: 80px;
            background-color: #fff;
            position: fixed;

        }
        .shouye {
            text-decoration: none;
        }
        .el-header {
            width: 100%;
            background-color: white;
            z-index: 999;
        }
        .a {
            width: 100%;
            background-color: #282c30;
            text-align: center;
        }
        div {
            display: block;
        }
        .a > div {
            overflow: hidden;
            margin-top: 23px;
        }
        .weibu {
            color: white;
            text-decoration: none;
            margin-right: 20px;
        }
        .info_web {
            color: #6b6b6b;
        }
        .dis_detail {
            width: 400px;
            height: 150px;
            position: relative;
            top: -150px;
        }
        .q {
            color: white;
        }
    </style>
</head>
<body>
<div id="app">
    <el-container>
        <el-header >
            <div class="top_b" style="height: 60px">
                <el-menu mode="horizontal" background-color="white">
                    <el-menu-item index="1"><img src="imgs/易装网.png"
                                                 style="width: 100%;height: 100%"></el-menu-item>
                    <el-menu-item index="2"><a class="shouye" href="homepage.html">首页</a></el-menu-item>
                    <el-submenu index="3">
                        <template slot="title">学装修</template>
                        <el-submenu index="3-1">
                            <template slot="title">按空间</template>
                            <el-menu-item index="3-1-1">客厅</el-menu-item>
                            <el-menu-item index="3-1-2">卧室</el-menu-item>
                            <el-menu-item index="3-1-3">餐厅</el-menu-item>
                        </el-submenu>
                        <el-submenu index="3-2">
                            <template slot="title">按风格</template>
                            <el-menu-item index="3-2-1">简约</el-menu-item>
                            <el-menu-item index="3-2-2">现代</el-menu-item>
                            <el-menu-item index="3-2-3">中式</el-menu-item>
                        </el-submenu>
                        <el-submenu index="3-3">
                            <template slot="title">按户型</template>
                            <el-menu-item index="3-3-1">小户型</el-menu-item>
                            <el-menu-item index="3-3-2">一居室</el-menu-item>
                            <el-menu-item index="3-3-3">二居室</el-menu-item>
                        </el-submenu>
                    </el-submenu>
                    <el-menu-item index="4"><a class="shouye" href="">装修材料</a></el-menu-item>
                    <el-menu-item index="5"><a class="shouye" href="">学装修</a></el-menu-item>
                    <el-menu-item index="6"><a class="shouye" href="shop.html">材料商城</a></el-menu-item>
                    </el-menu-item>
                    <el-menu-item><a class="shouye" href="">设计师信息</a></el-menu-item>
                    <div class="rag">
                        <a style="float: right;position: relative;font-size: 13px;color: #999;
                        margin-top: 23px;margin-right: 30px" href="">登录/注册</a>
                    </div>
                </el-menu>
            </div>
        </el-header>
        <el-main style="width: 1200px;margin: 0 auto;padding: 10px" >
            <!--分类导航菜单开始-->
            <div style="background-color: #0aa1ed">
                <el-menu @select="handleSelect" style="width: 1090px;margin: 0 auto" mode="horizontal" background-color="#0aa1ed"
                         text-color="#fff" active-text-color="#fff">
                    <el-menu-item v-for="pc in productCategoryArr" :index="pc.id">{{pc.title}}</el-menu-item>
                    <div style="float: right;position: relative;top: 10px">
                        <el-input type="text" @keydown.native.enter="search()" v-model="wd">
                            <!--在文本框中内嵌一个搜索按钮-->
                            <el-button @click="search()" slot="append" icon="el-icon-search"></el-button>
                        </el-input>
                    </div>
                </el-menu>
            </div>
            <!--分类导航菜单结束-->
            <!--详细商品开始-->
            <el-row gutter="20" style="margin-top: 10px">
                <el-col span="6" v-for="p in productArr">
                    <el-card style="margin-bottom: 10px">
                        <a :href="'/productDetail.html?id='+p.id">
                            <img :src="p.url" width="100%" height="233">
                        </a>
                        <p style="font-size: 14px;height: 30px"><a :href="'/productDetail.html?id='+p.id">{{p.title}}</a></p>
                        <p>
                            <b>￥{{p.price}}</b>
                            <span style="float: right">销量:{{p.sale_count}}件</span>
                        </p>
                    </el-card>
                </el-col>
            </el-row>
            <!--详细商品结束-->
        </el-main>
        <el-footer style="background-color: #282c30;height: 100%">
            <div class="a" style="margin: 0 auto">
                <div>
                    <a class="weibu" href="" target="_blank"><span>关于我们</span></a>
                    <a class="weibu" href="" target="_blank"><span>帮助中心</span></a>
                    <a class="weibu" href="" target="_blank"><span>联系我们</span></a>
                    <a class="weibu" href="" target="_blank"><span>VIP服务</span></a>
                </div>

                <el-row gutter="10">
                    <el-col span="6" >
                        <div style="margin: 0 auto">
                            <el-row gutter="10">
                                <el-col span="8">
                                    <img width="100" height="100" src="https://static.zhuangyi.com/css/index/img/ewm_m.png">
                                    <p class="q">手机版</p></el-col>
                                <el-col span="8">
                                    <img width="100" height="100" src="https://static.zhuangyi.com/css/index/img/ewm_xcx.jpg">
                                    <p class="q">小程序</p></el-col>
                                <el-col span="8">
                                    <img width="100" height="100" src="https://static.zhuangyi.com/css/index/img/ewm_wx.png">
                                    <p class="q">公众号</p></el-col>
                            </el-row>
                        </div>
                    </el-col>
                    <el-col span="18" >
                        <div class="info_web">
                            <p>Copyright © 2009-2023 zhuangyi.com All Rights Reserved</p>
                            <p>免责声明：本网站部分内容由用户自行上传，如权利人发现存在误传其作品情形，请及时与本站联系</p>
                            <p>河南车前草计算机科技有限公司 版权所有</p>
                        </div>
                    </el-col>
                </el-row>
            </div>
        </el-footer>
    </el-container>
</div>
</body>
<!--引入axios和vue框架文件-->
<script src="https://cdn.bootcdn.net/ajax/libs/axios/0.21.1/axios.min.js"></script>

<!-- import Vue before Element -->
<script src="https://cdn.staticfile.org/vue/2.6.14/vue.min.js"></script>
<!-- import JavaScript -->
<script src="https://cdn.staticfile.org/element-ui/2.15.9/index.min.js"></script>
<script>
    let v = new Vue({
        el: '#app',
        data: function () {
            return {
                productArr:[],
                productCategoryArr:[],
                wd:""
            }
        },
        methods:{
            handleSelect(key,keyPath){
                location.href="/productResult.html?id="+key;
            },
            search(){
                location.href='/productResult.html?wd='+v.wd;
            }
        },
        created:function () {
            //获取商品分类
            axios.get("/productCategory/select").then(function (response) {
                v.productCategoryArr=response.data;
            })
            //获取所有商品
            axios.get("/product/select").then(function (response) {
                v.productArr=response.data;
            })

        }
    })
</script>
</html>